

import openai
openai.api_key = "sk-pAwYtlMtv0DYPZxq1X8HpJxReonEgSAeBHhqvYIPWgLap32i"
openai.api_base = "https://api.chatanywhere.com.cn/v1"

import openai

def chat_with_openai(message):
    response = openai.ChatCompletion.create(
        model="gpt-3.5-turbo",
        messages=[
            {"role": "system", "content": "你是一个租房的客服服务专线"},
            {"role": "user", "content": message},
        ]
    )
    aa=   response["choices"][0]["message"]["content"]
    print(aa)
    return aa


# 调用示例
user_message = "你是谁"


if __name__ == '__main__':
    aa= chat_with_openai(user_message)
    print(aa)

